3.1.2 \(\int \tan ^2(c+d x) \, dx\) [2]

Optimal. Leaf size=14 \[ -x+\frac {\tan (c+d x)}{d} \]

[Out]

-x+tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3554, 8} \begin {gather*} \frac {\tan (c+d x)}{d}-x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^2,x]

[Out]

-x + Tan[c + d*x]/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps

\begin {align*} \int \tan ^2(c+d x) \, dx &=\frac {\tan (c+d x)}{d}-\int 1 \, dx\\ &=-x+\frac {\tan (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 23, normalized size = 1.64 \begin {gather*} -\frac {\text {ArcTan}(\tan (c+d x))}{d}+\frac {\tan (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^2,x]

[Out]

-(ArcTan[Tan[c + d*x]]/d) + Tan[c + d*x]/d

________________________________________________________________________________________

Maple [A]
time = 0.01, size = 21, normalized size = 1.50

method result size
norman \(-x +\frac {\tan \left (d x +c \right )}{d}\) \(15\)
derivativedivides \(\frac {\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(21\)
default \(\frac {\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(21\)
risch \(-x +\frac {2 i}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}\) \(24\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(tan(d*x+c)-arctan(tan(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 18, normalized size = 1.29 \begin {gather*} -\frac {d x + c - \tan \left (d x + c\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2,x, algorithm="maxima")

[Out]

-(d*x + c - tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 17, normalized size = 1.21 \begin {gather*} -\frac {d x - \tan \left (d x + c\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2,x, algorithm="fricas")

[Out]

-(d*x - tan(d*x + c))/d

________________________________________________________________________________________

Sympy [A]
time = 0.05, size = 15, normalized size = 1.07 \begin {gather*} \begin {cases} - x + \frac {\tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \tan ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2,x)

[Out]

Piecewise((-x + tan(c + d*x)/d, Ne(d, 0)), (x*tan(c)**2, True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 226 vs. \(2 (14) = 28\).
time = 0.64, size = 226, normalized size = 16.14 \begin {gather*} \frac {\pi - 4 \, d x \tan \left (d x\right ) \tan \left (c\right ) - \pi \mathrm {sgn}\left (2 \, \tan \left (d x\right )^{2} \tan \left (c\right ) + 2 \, \tan \left (d x\right ) \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) - 2 \, \tan \left (c\right )\right ) \tan \left (d x\right ) \tan \left (c\right ) - \pi \tan \left (d x\right ) \tan \left (c\right ) + 2 \, \arctan \left (\frac {\tan \left (d x\right ) \tan \left (c\right ) - 1}{\tan \left (d x\right ) + \tan \left (c\right )}\right ) \tan \left (d x\right ) \tan \left (c\right ) + 2 \, \arctan \left (\frac {\tan \left (d x\right ) + \tan \left (c\right )}{\tan \left (d x\right ) \tan \left (c\right ) - 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) + 4 \, d x + \pi \mathrm {sgn}\left (2 \, \tan \left (d x\right )^{2} \tan \left (c\right ) + 2 \, \tan \left (d x\right ) \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) - 2 \, \tan \left (c\right )\right ) - 2 \, \arctan \left (\frac {\tan \left (d x\right ) \tan \left (c\right ) - 1}{\tan \left (d x\right ) + \tan \left (c\right )}\right ) - 2 \, \arctan \left (\frac {\tan \left (d x\right ) + \tan \left (c\right )}{\tan \left (d x\right ) \tan \left (c\right ) - 1}\right ) - 4 \, \tan \left (d x\right ) - 4 \, \tan \left (c\right )}{4 \, {\left (d \tan \left (d x\right ) \tan \left (c\right ) - d\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2,x, algorithm="giac")

[Out]

1/4*(pi - 4*d*x*tan(d*x)*tan(c) - pi*sgn(2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 - 2*tan(d*x) - 2*tan(c))*ta
n(d*x)*tan(c) - pi*tan(d*x)*tan(c) + 2*arctan((tan(d*x)*tan(c) - 1)/(tan(d*x) + tan(c)))*tan(d*x)*tan(c) + 2*a
rctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)*tan(c) + 4*d*x + pi*sgn(2*tan(d*x)^2*tan(c) + 2*tan(
d*x)*tan(c)^2 - 2*tan(d*x) - 2*tan(c)) - 2*arctan((tan(d*x)*tan(c) - 1)/(tan(d*x) + tan(c))) - 2*arctan((tan(d
*x) + tan(c))/(tan(d*x)*tan(c) - 1)) - 4*tan(d*x) - 4*tan(c))/(d*tan(d*x)*tan(c) - d)

________________________________________________________________________________________

Mupad [B]
time = 2.51, size = 14, normalized size = 1.00 \begin {gather*} \frac {\mathrm {tan}\left (c+d\,x\right )}{d}-x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)^2,x)

[Out]

tan(c + d*x)/d - x

________________________________________________________________________________________